﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPageContent.master" AutoEventWireup="false"
    CodeFile="VoucherGENERALHdr.aspx.vb" Inherits="VoucherGENERALHdr" %>

<%@ Register Src="~/UserControls/DDL.ascx" TagName="DoubleFilteredDropDownList" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/OneFilteredDropDownList.ascx" TagName="OneFilteredDropDownList"
    TagPrefix="uc2" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Header" ContentPlaceHolderID="HeaderPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>


        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"
        Transparency="20">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    </telerik:RadWindowManager>
    <br />
    <br />
    <telerik:RadGrid ID="rgVoucher" DataSourceID="odsVoucher" CellSpacing="0" runat="server"
        AutoGenerateColumns="False" AllowSorting="True"
        AllowPaging="True" GridLines="None"  AllowFilteringByColumn="True">
        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        <PagerStyle Mode="NumericPages"></PagerStyle>
        <MasterTableView DataSourceID="odsVoucher" CommandItemDisplay="TopAndBottom" DataKeyNames="ID" 
            Width="880px" AllowMultiColumnSorting="True" GroupLoadMode="Server" NoMasterRecordsText="<%$ Resources:MainGrid , NoMasterRecordsText %>"
            NoDetailRecordsText="<%$ Resources:MainGrid , NoMasterRecordsText %>" AllowFilteringByColumn="true">

<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
            <CommandItemTemplate>
                <table>
                    <tr>
                        <td>
                            <asp:ImageButton ID="ibtnInitInsert" CausesValidation="false" CommandName="Add" runat="server"
                                ImageUrl="Design/images/Grid/AddRecord.gif" />
                            <asp:LinkButton ID="lbtnInitInsert" CausesValidation="false" runat="server" Font-Size="14px"
                                Text="<%$ Resources:MainGrid , AddNew %>" Visible="true" CommandName="Add" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnEditSelected" CausesValidation="false" CommandName="Edit"
                                runat="server" ImageUrl="Design/images/Grid/Edit.gif" />
                            <asp:LinkButton ID="lbtnEditSelected" CausesValidation="false" runat="server" Font-Size="Medium"
                                Text="<%$ Resources:MainGrid , EditSelected %>" Visible="true" CommandName="Edit" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnDeleteSelected" CausesValidation="false" CommandName="DeleteSelected"
                                OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>" runat="server"
                                ImageUrl="Design/images/Grid/Delete.gif" />
                            <asp:LinkButton ID="lbtnDeleteSelected" Font-Size="Medium" CausesValidation="false"
                                OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>" runat="server"
                                Text="<%$ Resources:MainGrid , DeleteSelected %>" CommandName="DeleteSelected" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnRebindGrid" CausesValidation="false" CommandName="RebindGrid"
                                runat="server" ImageUrl="Design/images/Grid/Refresh.gif" />
                            <asp:LinkButton ID="lbtnRebindGrid" Font-Size="Medium" CausesValidation="false" runat="server"
                                Text="<%$ Resources:MainGrid , Refresh %>" CommandName="RebindGrid" />
                            <asp:Literal ID="ltrArabicSpace" meta:ResourceKey="ArabicSpace" runat="server">
                            </asp:Literal>
                            
                        </td>
                    </tr>
                </table>
            </CommandItemTemplate>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn SortExpression="ID"  DataField="ID" UniqueName="ID" meta:ResourceKey="ID" AllowFiltering=false>
                   <HeaderStyle Width="20px" HorizontalAlign="Center" VerticalAlign="Middle" />
                  <ItemStyle Width="20px" />
                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn SortExpression="Year" HeaderButtonType="TextButton" FilterControlWidth="50px"
                    CurrentFilterFunction="EqualTo" DataField="Year" UniqueName="Year" meta:ResourceKey="gbcYear"
                    ShowFilterIcon="false" AutoPostBackOnFilter="true">
                   <HeaderStyle Width="30px" HorizontalAlign="Center" VerticalAlign="Middle" />
                  <ItemStyle Width="30px" />
                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="VoucherNo" HeaderButtonType="TextButton" FilterControlWidth="50px"
                    CurrentFilterFunction="Contains" DataField="VoucherNo" UniqueName="VoucherNo" meta:ResourceKey="gbcNumber"
                    ShowFilterIcon="false" AutoPostBackOnFilter="true">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="left" VerticalAlign="Middle" />
                </telerik:GridBoundColumn>

                <telerik:GridDropDownColumn DataField="VoucherType" ListTextField="<%$ Resources:SystemResource, lookup %>"
                    ReadOnly="True" SortExpression="VoucherType" UniqueName="VoucherType" Visible="true"
                    DataSourceID="odsVoucherType" ListValueField="MINOR" meta:ResourceKey="gbcVoucherType">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <FilterTemplate>
                        <center>
                            <telerik:RadComboBox ID="rcbFilterVoucherType" DataSourceID="odsVoucherType" DataTextField="<%$ Resources:SystemResource, lookup %>"
                                Width="90px" DropDownWidth="120px" DataValueField="MINOR" Height="200px" AppendDataBoundItems="true"
                                SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("VoucherType").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="VoucherTypeIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                        </center>
                        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                            <script type="text/javascript">
                                function VoucherTypeIndexChanged(sender, args) {
                                    var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                    tableView.filter("VoucherType", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridDropDownColumn>
                

                <telerik:GridDateTimeColumn PickerType="DatePicker" SortExpression="VoucherDate"
                    DataFormatString="{0:MM/dd/yyyy}" ShowFilterIcon="false" AutoPostBackOnFilter="true"
                    HeaderButtonType="TextButton" DataField="VoucherDate" UniqueName="VoucherDate"
                    meta:ResourceKey="gbcVoucherDate" FilterControlWidth="60px">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridDateTimeColumn>
                <telerik:GridBoundColumn DataField="Debit" meta:ResourceKey="gbcDebit" ReadOnly="True"
                    SortExpression="Debit" CurrentFilterFunction="Contains" FilterControlWidth="30px"
                    UniqueName="Debit" Visible="true" DataFormatString="{0:###,###.##}" Aggregate="Sum"
                    FooterStyle-HorizontalAlign="Center">
<FooterStyle HorizontalAlign="Center"></FooterStyle>

                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="70px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="70px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Credit" meta:ResourceKey="gbcCredit" ReadOnly="True"
                    SortExpression="Credit" CurrentFilterFunction="Contains" FilterControlWidth="30px"
                    UniqueName="Credit" Visible="true" DataFormatString="{0:###,###.##}" Aggregate="Sum"
                    FooterStyle-HorizontalAlign="Center">
<FooterStyle HorizontalAlign="Center"></FooterStyle>

                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </telerik:GridBoundColumn>
                <telerik:GridDropDownColumn DataField="CostCenter" ListTextField="<%$ Resources:SystemResource, lookup %>"
                    ReadOnly="True" SortExpression="CostCenter" UniqueName="CostCenter" Visible="true"
                    DataSourceID="odsCostCenter" ListValueField="MINOR" meta:ResourceKey="gbcCostCenter">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <FilterTemplate>
                        <center>
                            <telerik:RadComboBox ID="rcbFilterCostCenter" DataSourceID="odsCostCenter" DataTextField="<%$ Resources:SystemResource, lookup %>"
                                Width="90px" DataValueField="MINOR" Height="200px" AppendDataBoundItems="true"
                                SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("CostCenter").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="CostCenterIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                        </center>
                        <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
                            <script type="text/javascript">
                                function CostCenterIndexChanged(sender, args) {
                                    var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                    tableView.filter("CostCenter", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridDropDownColumn>
                <telerik:GridDropDownColumn DataField="MainCostCenter" ListTextField="<%$ Resources:SystemResource, lookup %>"
                    ReadOnly="True" SortExpression="CostCenter" UniqueName="MainCostCenter" Visible="true"
                    DataSourceID="odsMainCostCenter" ListValueField="MINOR" meta:ResourceKey="gbcMainCostCenter">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <FilterTemplate>
                        <center>
                            <telerik:RadComboBox ID="rcbFilterMainCostCenter" DataSourceID="odsMainCostCenter"
                                DataTextField="<%$ Resources:SystemResource, lookup %>" Width="90px" DataValueField="MINOR"
                                Height="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("MainCostCenter").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="MainCostCenterIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                        </center>
                        <telerik:RadScriptBlock ID="RadScriptBlock4" runat="server">
                            <script type="text/javascript">
                                function MainCostCenterIndexChanged(sender, args) {
                                    var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                    tableView.filter("MainCostCenter", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridDropDownColumn>
                <telerik:GridBoundColumn DataField="Remarks" meta:ResourceKey="gbcMainRemarks" SortExpression="Remarks"
                    ShowFilterIcon="false" UniqueName="Remarks" Visible="false" CurrentFilterFunction="Contains"
                    FilterControlWidth="60px" AutoPostBackOnFilter="true">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridBoundColumn>
                <telerik:GridHyperLinkColumn DataTextField="RecordStatus" Visible="false" SortExpression="RecordStatus"
                    UniqueName="RecordStatus">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridHyperLinkColumn>
            </Columns>
        </MasterTableView>
        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
        </ExportSettings>
        <GroupingSettings CaseSensitive="false" />
        <ClientSettings >
        <ClientEvents />
            <Selecting AllowRowSelect="True" />
        </ClientSettings>

<FilterMenu EnableImageSprites="False"></FilterMenu>
    </telerik:RadGrid>
 
        
     <asp:ObjectDataSource ID="odsVoucher" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBVoucherGENERALHdrSP" DeleteMethod="QueryDatabase" 
        InsertMethod="QueryDatabase" UpdateMethod="QueryDatabase">
        <InsertParameters>
            <asp:Parameter Name="QueryType" Type="Object" />
            <asp:Parameter Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvVoucherGENERALHdr" Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="DeleteVoucherGENERALHdr" Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="QueryType" Type="Object" />
            <asp:Parameter Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsCostCenter" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvCostCenter" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsMainCostCenter" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvMainCostCenter" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsAccount" runat="server" SelectMethod="QueryDatabase"
        TypeName="AccountsSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="rtvAccounts" Name="Operation" Type="String" />
            <asp:Parameter Name="AccountNo" Type="String" />
            <asp:Parameter Name="AccountNameAr" Type="String" />
            <asp:Parameter Name="AccountNameEn" Type="String" />
            <asp:Parameter Name="ParentID" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsRecordStatus" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvRecordStatus" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsVoucherType" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvVoucherType" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:HiddenField ID="hdnVoucherID" runat="server" />

</asp:Content>
